<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            /* margin: 0; */
        }
        div{
            width: 100px;
            height: 100px;
            background-color: red;
            position: relative;
            padding: 20px;
        }
        p{
            width: 50px;
            height: 50px;
            background-color: aqua;
            position: absolute;
            left: 0px;
            top: 0px;
        }
    </style>
</head>
<body>
    <div>
        <p></p>
    </div>
    <script>
        console.log(window.innerWidth);
        let p = document.querySelector('p')
        // 不脱标 父的padding+自身margin
        
        // 脱标  自身margin+left/top
        console.log(p.offsetLeft);
        console.log(p.offsetTop);
        
        
    </script>
</body>
</html>